Today electronic recording of handwritten information has many applications. An example of a writing tool suitable for this purpose is described in WO 01/71473 in the form of an electronic pen. An electronic pen will be used throughout this document to represent a writing tool suitable for recording handwritten information, without the invention in any way being restricted to such a pen.
Electronic pens are intended to be used in hand-held and portable applications, and for this reason, because of consequent restrictions on power consumption, space and cost, it is necessary to store the recorded electronic handwriting as efficiently as possible and in a way that uses as little memory as possible.
U.S. Pat. No. 6,101,280 describes a method and a device for compressing electronic handwriting, consisting of a sequence of pen strokes, each of which constitutes a sequence of pairs of (x, y)-coordinates for points arranged (sampled) in time order along the pen stroke. In order to specify each pair of coordinates with adequate resolution, nominally one 16-bit integer is required for the x-coordinate and the y-coordinate, respectively. Prior-art technique, including that from U.S. Pat. No. 6,101,280, shows, however, a series of measures that can be taken in order to reduce the storage space required for the pen strokes.
By not storing the points' coordinates as absolute values but instead as difference or delta values relative to the immediately preceding point, a considerable reduction in data is achieved. It is normally sufficient to have 8 bits per relative coordinate, compared to twice that for absolute coordinates. Even better data reduction is achieved by making use of some form of prediction or extrapolation, for example polynomial approximation, of the expected position of a given point based on a number of preceding points in the sequence. Each point will thus be represented by the error or deviation between its expected position and its current position.
Before the final storage of the coordinates of the recorded points, the use is known of data-compressing source coding—often statistical coding such as Huffman coding or arithmetic coding—of the coordinates that have been relative coded in accordance with the above.
Even before the relative coding and the data-compressing source coding, U.S. Pat. No. 6,101,280 shows, however, that many of the recorded points can be eliminated without significantly worsening the visual quality when the electronic handwriting is later to be recreated, for example displayed on a screen. For this purpose, so-called resampling of the sequence of recorded points is carried out. The Douglas-Peucker's algorithm is often used for resampling a discrete curve, for example consisting of a sequence of points along a recorded pen stroke, and this is carried out in the following way. A curve segment between a first point and a second point, which is located at a distance from the first point, has a straight line drawn experimentally between the first and the second point. If the maximal distance between this line and any point on the curve segment is less than a limit value, the curve segment is replaced by the straight line. A straight line can be represented by considerably less data than a curve segment, whereby the saving in storage space is evident. On the other hand, if the maximal distance exceeds the limit value, a first shorter line is created between the first point and a midpoint on the curve segment and a second shorter line is created between this midpoint and the second point, the above procedure being repeated recursively on these shorter lines. After the resampling has been concluded, only those points that have not been replaced by a line are saved. The curve segment is thus represented by these points remaining after the resampling.
Although the resampling procedure in U.S. Pat. No. 6,101,280 is fully capable of real data reduction, it is still associated with certain disadvantages. As the resampling is not carried out until a complete pen stroke, from “pen-down” to “pen-up”, has been entered by the user, it can often be a question of long sequences of points and thus large amounts of coordinate data that have to be processed at one and the same time during the resampling. The storage and processing of large amounts of coordinate data require of course the available working memory to be sufficiently large. It is, however, far from the case that an electronic pen or a similar portable miniaturized handwriting device has a large working memory; on the contrary, the constant market demands for low cost/small size/low power consumption mean that the working memory of the pen (or the like) often has a limited storage capacity. In order to be able also to carry out resampling of long sequences of points (long pen strokes) it is thus necessary for the pen to be provided with a working memory that is (over-)dimensioned for the worst case scenario, or it is necessary not to carry out resampling of sequences of points that are too long. Both alternatives have evident disadvantages.
Another disadvantage of the resampling in accordance with the above is that time delays can arise for the resampling, the subsequent point coordinate coding and the storage, for example if the user pauses while making a pen stroke without lifting the pen. Only later, once the pen stroke has been completed and the pen has been lifted from the writing base, can the sampling and the subsequent operations commence.